package
{
	import flash.display.Loader;
	import flash.events.*;
	import flash.external.ExternalInterface;
	import flash.net.URLRequest;
	import flash.utils.*;
	
	public class Global
	{
		public static var AssetsPath:String = '';
		public static var AppPath:String = '';
		
		public static function Init():void{
			AppPath = Base64.decode(ExternalInterface.call('GetAppPath'));
			AssetsPath = AppPath + 'assets/';
		}
		
		public static function Uninit():void{
			
		}
		
		public static function DebugMsg(msg: String):void{			
			ExternalInterface.call('DebugMsg', msg);	
		}	
		
		public static function GetLat():Number{
			return Number(Base64.decode(ExternalInterface.call('GetLat')));	
		}
		
		public static function GetLng():Number{
			return Number(Base64.decode(ExternalInterface.call('GetLng')));	
		}
		
		public static function ShoTip(id:Number):void{
			ExternalInterface.call('ShowTip', id);	
		}
		
		public static function LoadPic(obj:Object, n, path: String):void{
			var loader:Loader = new Loader();
			var urlR:URLRequest = new URLRequest();
			urlR.url = path;
			loader.load(urlR);
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, 
				function (e:Object):void{
					obj[n] = loader.content;
				}
			);			
		}
	}
}